<html>
<head>
    <script>
        function loaded()
        {
            document.getElementsByTagName('h4')[0].innerHTML = document.domain;

            // A manual click should navigate.
            if (window.eventSender) {
                var button = document.getElementById("b");
                eventSender.mouseMoveTo(button.offsetLeft + 4, button.offsetTop + 4);
                eventSender.mouseDown();
                eventSender.mouseUp();
            }
        }

        function performTest()
        {
            // User gestures are propagated through a single setTimeout(), but
            // not nested setTimeout()s. Ensure that the user gesture token
            // doesn't propagate, but that the navigation goes through anyway,
            // because there was a user gesture in this iframe previously.
            setTimeout(function() {
                setTimeout(function() {
                    parent.location = "http://localhost:8000/security/frameNavigation/resources/navigation-changed-iframe.html";
                }, 0);
            }, 0);
        }
    </script>
</head>
<body onload="loaded();">
    <h4>DOMAIN</h4>
    <button id="b" onclick="performTest();">Perform Test</button>
</body>
</html>
